//60.12.147.189:3080
var io = require('socket.io/node_modules/socket.io-client');

var conn = io.connect('http://127.0.0.1:8080/');

//conn.emit('setup', { client: '1234567890', token: 'token', background: 1 });
conn.on('connect', function() {
    conn.emit('join', {a:1});
    conn.emit('echo', {a:2});
    conn.emit('join', {a:3});
    console.log('link ok...');

    //conn.emit('setup', { client: 'xxxxx', background: 'true' });
});

conn.on('echo', function(data) {
    console.log(data);
});

conn.on('error', function(data) {
    console.log(data);
});

conn.on('disconnect', function(data) {
    console.log('disconnect.\n');
});

conn.on('wall', function(data) {
    console.dir(JSON.stringify(data));
    //console.dir(data.result.data);
});

conn.on('push', function(data) {
    console.dir(data);
});

conn.on('message', function(data) {
    console.dir(data);
});

conn.on('notific', function(data) {
    console.dir(data);
});

conn.on('setup', function(data) {
    console.dir(data);
});

/*
conn.on('', function(data){
    
});
*/